package com.kfh.ybracelet.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 好友申请列表bean
 * Created by Aaron on 16/1/19.
 */
public class InviteBean implements Parcelable {

    public int code;
    public String code_msg;

    public List<InvitedListEntity> invitedList;

    public static class InvitedListEntity implements Parcelable {

        public UserEntity user;
        public String _id;
        public long inviteTime;
        public String inviteWord;
        public int state;

        public static class UserEntity implements Parcelable {

            public String _id;
            public String phoneNum;
            public String imgUrl;
            public String nickName;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this._id);
                dest.writeString(this.phoneNum);
                dest.writeString(this.imgUrl);
                dest.writeString(this.nickName);
            }

            public UserEntity() {
            }

            protected UserEntity(Parcel in) {
                this._id = in.readString();
                this.phoneNum = in.readString();
                this.imgUrl = in.readString();
                this.nickName = in.readString();
            }

            public static final Creator<UserEntity> CREATOR = new Creator<UserEntity>() {
                public UserEntity createFromParcel(Parcel source) {
                    return new UserEntity(source);
                }

                public UserEntity[] newArray(int size) {
                    return new UserEntity[size];
                }
            };
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeParcelable(this.user, 0);
            dest.writeString(this._id);
            dest.writeLong(this.inviteTime);
            dest.writeString(this.inviteWord);
            dest.writeInt(this.state);
        }

        public InvitedListEntity() {
        }

        protected InvitedListEntity(Parcel in) {
            this.user = in.readParcelable(UserEntity.class.getClassLoader());
            this._id = in.readString();
            this.inviteTime = in.readLong();
            this.inviteWord = in.readString();
            this.state = in.readInt();
        }

        public static final Creator<InvitedListEntity> CREATOR = new Creator<InvitedListEntity>() {
            public InvitedListEntity createFromParcel(Parcel source) {
                return new InvitedListEntity(source);
            }

            public InvitedListEntity[] newArray(int size) {
                return new InvitedListEntity[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.code);
        dest.writeString(this.code_msg);
        dest.writeTypedList(invitedList);
    }

    public InviteBean() {
    }

    protected InviteBean(Parcel in) {
        this.code = in.readInt();
        this.code_msg = in.readString();
        this.invitedList = in.createTypedArrayList(InvitedListEntity.CREATOR);
    }

    public static final Creator<InviteBean> CREATOR = new Creator<InviteBean>() {
        public InviteBean createFromParcel(Parcel source) {
            return new InviteBean(source);
        }

        public InviteBean[] newArray(int size) {
            return new InviteBean[size];
        }
    };
}
